package com.ruoyi.wifiauth.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.wifiauth.domain.WifiAuthLog;
import com.ruoyi.wifiauth.service.IWifiAuthLogService;

@RestController
@RequestMapping("/auth/session")
public class WifiAuthLogController extends BaseController {

    @Autowired
    private IWifiAuthLogService wifiAuthLogService;

    @RequiresPermissions("wifi:auth:list")
    @GetMapping("/list")
    public TableDataInfo list(WifiAuthLog query) {
        startPage();
        List<WifiAuthLog> list = wifiAuthLogService.selectWifiAuthLogList(query);
        return getDataTable(list);
    }

    @RequiresPermissions("wifi:auth:export")
    @Log(title = "WiFi认证会话", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WifiAuthLog query) {
        List<WifiAuthLog> list = wifiAuthLogService.selectWifiAuthLogList(query);
        ExcelUtil<WifiAuthLog> util = new ExcelUtil<>(WifiAuthLog.class);
        util.exportExcel(response, list, "认证会话数据");
    }
} 